var e = require("./../../components/area-picker/area-picker.js");

Page({
    data: {},
    onLoad: function(t) {
        var i = this;
    },
    applySubmit(v) {
        var e = this,
            t = /^(\d{3,4}-\d{6,9})$/,
            i = /^\+?\d[\d -]{8,12}\d/,
            tel = v.detail.value.tel;
        if (!/^([0-9]{6,12})$/.test(tel) && !t.test(tel) && !i.test(tel)) return wx.showToast({
            title: "联系电话格式不正确"
        }), !1;
        getApp().core.showLoading({
            title: "正在保存",
            mask: !0
        });
        var a = v.detail.value.district;
        getApp().request({
            url: getApp().api.user.apply_save,
            method: "post",
            data: {
                name: v.detail.value.name,
                realname: v.detail.value.realname,
                tel: tel,
                address: v.detail.value.address,
                district: a
            },
            success: function(t) {
                getApp().core.hideLoading(), 0 == t.code && getApp().core.showModal({
                    title: "提示",
                    content: t.msg,
                    showCancel: !1,
                    success: function(e) {
                      getApp().core.redirectTo({    
                        url: "/pages/index/index"
                      })
                    }
                }), 1 == t.code && wx.showToast({
                    title: t.msg
                });
            }
        });
    },
    onShow: function() {
        getApp().page.onShow(this);
    }
});